
<meta charset="utf-8">
<script>
    var rightyear = 1900;
    var inputyear = prompt("请输入出生年份");
    var diff = inputyear-rightyear;
    if(diff%12==0){
        alert("鼠");
    }else if(diff%12==1||diff%12==-11){
        alert("牛");
    }else if(diff%12==2||diff%12==-10){
        alert("虎");
    }else if(diff%12==3||diff%12==-9){
        alert("兔");
    }else if(diff%12==4||diff%12==-8){
        alert("龙");
    }else if(diff%12==5||diff%12==-7){
        alert("蛇");
    }else if(diff%12==6||diff%12==-6){
        alert("马");
    }else if(diff%12==7||diff%12==-5){
        alert("羊");
    }else if(diff%12==8||diff%12==-4){
        alert("猴");
    }else if(diff%12==9||diff%12==-3){
        alert("鸡");
    }else if(diff%12==10||diff%12==-2){
        alert("狗");
    }else if(diff%12==11||diff%12==-1){
        alert("猪");
    }else{
        alert("请输入正确的年份！");
    }
    
</script>